import propTypes from 'prop-types'
import { FormControlLabel, Checkbox, Typography } from '@mui/material'

const MyCheckBox = ({field, label, disabled}) => {
  return (
    <FormControlLabel
      control={<Checkbox {...field} checked={field.value} disabled={disabled}/>}
      label={<Typography variant="subtitle1">{label}</Typography>}
    />
  )
}

MyCheckBox.propTypes = {
  disabled: propTypes.bool,
  label: propTypes.string,
  field: propTypes.object.isRequired
}

MyCheckBox.defaultProps = {
  disabled: false
}

export default MyCheckBox